package com.rain.cy.util;

import cn.hutool.json.JSONUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * @author yu_chen
 * @since 2021/10/11 23:20
 */
public class PrintUtil {

    public static void printJson(String key, Object o) {
        Map<String, String> map = new HashMap<>();
        String toJsonStr = JSONUtil.toJsonStr(o);
        map.put(key, toJsonStr);
        String jsonStr = JSONUtil.toJsonStr(map);
        System.out.println(jsonStr);
    }

    public static void printJson(Object o) {
        String jsonStr = JSONUtil.toJsonStr(o);
        System.out.println(jsonStr);
    }
}
